m.Append(ID_ABOUT, '&About...', 'About this program')
b = self.menuBar = wx.MenuBar()
b.Append(self.fileMenu, '&File')
b.Append(self.editMenu, '&Edit')
b.Append(self.viewMenu, '&View')
b.Append(self.optionsMenu, '&Options')
b.Append(self.helpMenu, '&Help')
self.SetMenuBar(b)
self.Bind(wx.EVT_MENU, self.OnFileNew, id = ID_NEW)
self.Bind(wx.EVT_MENU, self.OnFileOpen, id = ID_OPEN)
self.Bind(wx.EVT_MENU, self.OnFileRevert, id = ID_REVERT)
self.Bind(wx.EVT_MENU, self.OnFileClose, id = ID_CLOSE)
self.Bind(wx.EVT_MENU, self.OnFileSave, id = ID_SAVE)
self.Bind(wx.EVT_MENU, self.OnFileSaveAs, id = ID_SAVEAS)
self.Bind(wx.EVT_MENU, self.OnFileUpdateNamespace, id = ID_NAMESPACE)
self.Bind(wx.EVT_MENU, self.OnFilePrint, id = ID_PRINT)
self.Bind(wx.EVT_MENU, self.OnExit, id = ID_EXIT)
self.Bind(wx.EVT_MENU, self.OnUndo, id = ID_UNDO)
self.Bind(wx.EVT_MENU, self.OnRedo, id = ID_REDO)
self.Bind(wx.EVT_MENU, self.OnCut, id = ID_CUT)
self.Bind(wx.EVT_MENU, self.OnCopy, id = ID_COPY)
self.Bind(wx.EVT_MENU, self.OnCopyPlus, id = ID_COPY_PLUS)
self.Bind(wx.EVT_MENU, self.OnPaste, id = ID_PASTE)
self.Bind(wx.EVT_MENU, self.OnPastePlus, id = ID_PASTE_PLUS)
self.Bind(wx.EVT_MENU, self.OnClear, id = ID_CLEAR)
self.Bind(wx.EVT_MENU, self.OnSelectAll, id = ID_SELECTALL)
self.Bind(wx.EVT_MENU, self.OnEmptyBuffer, id = ID_EMPTYBUFFER)
self.Bind(wx.EVT_MENU, self.OnAbout, id = ID_ABOUT)
self.Bind(wx.EVT_MENU, self.OnHelp, id = ID_HELP)
self.Bind(wx.EVT_MENU, self.OnAutoCompleteShow, id = ID_AUTOCOMP_SHOW)
self.Bind(wx.EVT_MENU, self.OnAutoCompleteMagic, id = ID_AUTOCOMP_MAGIC)
self.Bind(wx.EVT_MENU, self.OnAutoCompleteSingle, id = ID_AUTOCOMP_SINGLE)
self.Bind(wx.EVT_MENU, self.OnAutoCompleteDouble, id = ID_AUTOCOMP_DOUBLE)
self.Bind(wx.EVT_MENU, self.OnCallTipsShow, id = ID_CALLTIPS_SHOW)
self.Bind(wx.EVT_MENU, self.OnCallTipsInsert, id = ID_CALLTIPS_INSERT)
self.Bind(wx.EVT_MENU, self.OnWrap, id = ID_WRAP)
self.Bind(wx.EVT_MENU, self.OnUseAA, id = ID_USEAA)
self.Bind(wx.EVT_MENU, self.OnToggleMaximize, id = ID_TOGGLE_MAXIMIZE)
self.Bind(wx.EVT_MENU, self.OnShowLineNumbers, id = ID_SHOW_LINENUMBERS)
self.Bind(wx.EVT_MENU, self.OnAutoSaveSettings, id = ID_AUTO_SAVESETTINGS)
self.Bind(wx.EVT_MENU, self.OnSaveHistory, id = ID_SAVEHISTORY)
self.Bind(wx.EVT_MENU, self.OnSaveHistoryNow, id = ID_SAVEHISTORYNOW)
self.Bind(wx.EVT_MENU, self.OnClearHistory, id = ID_CLEARHISTORY)
self.Bind(wx.EVT_MENU, self.OnSaveSettings, id = ID_SAVESETTINGS)
self.Bind(wx.EVT_MENU, self.OnDelSettingsFile, id = ID_DELSETTINGSFILE)
self.Bind(wx.EVT_MENU, self.OnEditStartupScript, id = ID_EDITSTARTUPSCRIPT)
self.Bind(wx.EVT_MENU, self.OnExecStartupScript, id = ID_EXECSTARTUPSCRIPT)
self.Bind(wx.EVT_MENU, self.OnFindText, id = ID_FIND)
self.Bind(wx.EVT_MENU, self.OnFindNext, id = ID_FINDNEXT)
self.Bind(wx.EVT_MENU, self.OnToggleTools, id = ID_SHOWTOOLS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_NEW)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_OPEN)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_REVERT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CLOSE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SAVE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SAVEAS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_NAMESPACE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_PRINT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_UNDO)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_REDO)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CUT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_COPY)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_COPY_PLUS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_PASTE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_PASTE_PLUS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CLEAR)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SELECTALL)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_EMPTYBUFFER)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_AUTOCOMP_SHOW)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_AUTOCOMP_MAGIC)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_AUTOCOMP_SINGLE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_AUTOCOMP_DOUBLE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CALLTIPS_SHOW)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CALLTIPS_INSERT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_WRAP)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_USEAA)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SHOW_LINENUMBERS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_AUTO_SAVESETTINGS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SAVESETTINGS)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_DELSETTINGSFILE)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_EXECSTARTUPSCRIPT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SAVEHISTORY)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SAVEHISTORYNOW)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_CLEARHISTORY)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_EDITSTARTUPSCRIPT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_FIND)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_FINDNEXT)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id = ID_SHOWTOOLS)
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
self.Bind(wx.EVT_FIND, self.OnFindNext)
self.Bind(wx.EVT_FIND_NEXT, self.OnFindNext)
self.Bind(wx.EVT_FIND_CLOSE, self.OnFindClose)
def OnShowLineNumbers(self, event):
win = wx.Window.FindFocus()
if hasattr(win, 'lineNumbers'):
win.lineNumbers = event.IsChecked()
win.setDisplayLineNumbers(win.lineNumbers)
def OnToggleMaximize(self, event):
self.Maximize(not self.IsMaximized())
def OnFileNew(self, event):
self.bufferNew()
def OnFileOpen(self, event):
self.bufferOpen()
def OnFileRevert(self, event):
self.bufferRevert()
def OnFileClose(self, event):
self.bufferClose()
def OnFileSave(self, event):
self.bufferSave()
def OnFileSaveAs(self, event):
self.bufferSaveAs()
def OnFileUpdateNamespace(self, event):
self.updateNamespace()
def OnFilePrint(self, event):
self.bufferPrint()
def OnExit(self, event):
self.Close(False)
def OnUndo(self, event):
win = wx.Window.FindFocus()
win.Undo()
def OnRedo(self, event):
win = wx.Window.FindFocus()
win.Redo()
def OnCut(self, event):
win = wx.Window.FindFocus()
win.Cut()
def OnCopy(self, event):
win = wx.Window.FindFocus()
win.Copy()
def OnCopyPlus(self, event):
win = wx.Window.FindFocus()
win.CopyWithPrompts()
def OnPaste(self, event):
win = wx.Window.FindFocus()
win.Paste()
def OnPastePlus(self, event):
win = wx.Window.FindFocus()
win.PasteAndRun()
def OnClear(self, event):
win = wx.Window.FindFocus()
win.Clear()
def OnEmptyBuffer(self, event):
win = wx.Window.FindFocus()
d = wx.MessageDialog(self, 'Are you sure you want to clear the edit buffer,\ndeleting all the text?', 'Empty Buffer', wx.OK | wx.CANCEL | wx.ICON_QUESTION)
d = wx.MessageDialog(self, 'Do you want to revert to the default settings?\n' + 'A restart is needed for the change to take effect', 'Warning', wx.OK | wx.CANCEL | wx.ICON_QUESTION)